package nc.bs.pub.action;

import nc.bs.framework.common.NCLocator;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.ApproveStatusCheckRule;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

import nc.bs.yst.purrollingplan.plugin.bpplugin.PURROLLINGPLANPluginPoint;
import nc.vo.yst.purrollingplan.AggPurrollingplanHVO;
import nc.itf.yst.IPURROLLINGPLANMaintain;

public class N_H0H4_APPROVE extends AbstractPfAction<AggPurrollingplanHVO> {

	public N_H0H4_APPROVE() {
		super();
	}

	@Override
	protected CompareAroundProcesser<AggPurrollingplanHVO> getCompareAroundProcesserWithRules(
			Object userObj) {
		CompareAroundProcesser<AggPurrollingplanHVO> processor = new CompareAroundProcesser<AggPurrollingplanHVO>(
				PURROLLINGPLANPluginPoint.APPROVE);
		processor.addBeforeRule(new ApproveStatusCheckRule());
		return processor;
	}

	@Override
	protected AggPurrollingplanHVO[] processBP(Object userObj,
			AggPurrollingplanHVO[] clientFullVOs, AggPurrollingplanHVO[] originBills) {
		AggPurrollingplanHVO[] bills = null;
		IPURROLLINGPLANMaintain operator = NCLocator.getInstance().lookup(
				IPURROLLINGPLANMaintain.class);
		try {
			bills = operator.approve(clientFullVOs, originBills);
		} catch (BusinessException e) {
			ExceptionUtils.wrappBusinessException(e.getMessage());
		}
		return bills;
	}

}
